package com.mall.user.converter;

import com.mall.user.dal.entitys.Member;
import com.mall.user.dto.*;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.springframework.stereotype.Component;

/**
 *  ciggar
 * create-date: 2019/7/31-上午12:05
 */
@Component
@Mapper(componentModel = "spring")
public interface MemberConverter {

    @Mappings({})
    QueryMemberResponse member2Res(Member member);

    @Mappings({})
    UserLoginResponse member2UserLoginRes(Member member);

    @Mappings({})
    Member updateReq2Member(UpdateMemberRequest request);

    @Mappings({
            @Mapping(source = "userName", target = "username"),
            @Mapping(source = "userPwd", target = "password")
    })
    Member registerReq2Member(UserRegisterRequest request);
    @Mappings({
            @Mapping(source = "id" ,target="uid")
    })
    UserInfoDto member2UserInfo(Member member);
}
